package com.gigi.searchcenterbackendmaster.model.enums;

import cn.hutool.core.util.StrUtil;

/**
 * 搜索类型枚举
 *
 * @author Gigi
 */
public enum SearchTypeEnum {
    ARTICLE("article", "文章"),
    PICTURE("picture", "图片"),
    USER("user", "用户"),
    ;
    private String value;
    private String desc;

    SearchTypeEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static SearchTypeEnum getEnumByValue(String value) {
        if (StrUtil.isBlank(value)) {
            return null;
        }
        for (SearchTypeEnum searchTypeEnum : SearchTypeEnum.values()) {
            if (searchTypeEnum.getValue().equals(value)) {
                return searchTypeEnum;
            }
        }
        return null;
    }

    public String getValue() {
        return value;
    }

}
